<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>My Homework</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel='stylesheet' type='text/css' media='all' href='__TMPL__User/css/userManagement.css' />
		<script src="__TMPL__Public/jquery/js/jquery-1.6.2.min.js" type="text/javascript" ></script>
		<script src="__TMPL__Public/jquery/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript" ></script>
		<script type="text/javascript" src="__TMPL__Group/js/group.js" ></script>
		<style type='text/css' media='screen'>
			@import "css/userManagement.css";
		</style>
		<script type="text/javascript">
			$(function() {
				$("#dialog").leanModal({
					top : 200,
					overlay : 0.4,
					closeButton : ".modal_close"
				});

				$("#form1").submit(function(event) {

					/* stop form from submitting normally */
					event.preventDefault();

					/* get some values from elements on the page: */
					var $form = $(this), url = $form.attr('action');

					/* Send the data using post and put the results in a div */
					$.post(url, $("#form1").serialize(), function(result) {
						result = JSON.parse(result);
						if(result.status == 1) {
							alert(result.info);
							window.location = "__APP__/User/userManagement";
						} else {
							alert(result.info);
						}
					});
				});
				$("#form2").submit(function(event) {

					/* stop form from submitting normally */
					event.preventDefault();

					/* get some values from elements on the page: */
					var $form = $(this), url = $form.attr('action');
					var stu_id = $form.attr('stu_id');

					/* Send the data using post and put the results in a div */
					$.get(url, {
						'stu_id': stu_id
					}, function(result) {
						result = JSON.parse(result);
						if(result.status == 1) {
							alert('删除成功');
							window.location = "__APP__/User/userManagement";
						} else {
							alert('删除失败');
							alert(result.info);
						}
					});
				});
			});

		</script>
	</head>
	<body id="threeColLayout" class="home">
		<div id="wrapper">
			<div id="header">
				<h1>My Homework</h1>
				<ul id="mainNav">
					<li>
						<a href="__APP__/Index/adminMain" id="home">首页</a>
					</li>
				</ul>
			</div><!-- end #header -->
			<div id= "group">
				<fieldset id="info">
					<h3> 用户管理 </h3>
					<div>
						<table border="1" cellpadding="10">
							<tr>
								<th align="center">学号</th>
								<th align="center">姓名</th>
								<th align="center">小组</th>
								<th align="center">操作</th>
							</tr>
							<volist name="students" id='vo' key = 'k'>
								<tr>
									<td>{$vo['studentid']}</td>
									<td>{$vo['name']}</td>
									<td>{$vo['group_name']}</td>
									<td>
										<form action='__APP__/User/delete' stu_id = '{$vo['id']}' id="form2">
										<input type="submit" value="删除"/>
									</form>
									</td>
									
									
								</tr>
							</volist>
						</table>
					</div>
					<div style="float:right;">
						<div id="button">
							<br/>
							<button id="dialog" href="#form1">
								添加用户
							</button>
						</div>
					</div>
				</fieldset>
			</div>
			<div id="footer"></div>
			<!-- end #footer -->
		</div><!-- end #wrapper -->
		<div style="display:none">
			<script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540' language='JavaScript' charset='gb2312'></script>
		</div>
		<form action = "__APP__/User/addStudent" name="create_student" id="form1" method="post">
			学号
			<input type="text" id="studentid" name="studentid"/>
			<br />
			<br />
			姓名
			<input type="text" id="name" name="name"/>
			<br />
			<br />
			密码
			<input type="password" id="password" name="password"/>
			<br />
			<br />
			<input type="submit" id="_submit" name="submit" value="创建"/>
		</form>
		<div id="lean_overlay" style="display: none; opacity: 0.5; "></div>
	</body>
</html>